﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/TemplateUser.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ import Namespace="ManageBanking.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <link href="../../Content/css/SucErr1.css" rel="stylesheet" type="text/css" />

    <script src="../../Scripts/functions.js" type="text/javascript"></script>

    <script src="../../Scripts/wysiwyg.js" type="text/javascript"></script>

    <script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
     <script language="javascript" type="text/javascript">
         $(document).ready(function() {
    
             $('#f1').validate({
                 rules: {
                     username: {
                         required: true
                     },
                    
                    
                    
                     name: {
                         required: true
                     },
                     identificard: {
                         required: true,
                         number: true,
                         maxlength:20,
                         minlength: 9
                     },
                     birth: {
                         required: true
                     },
                     address: {
                         required: true

                     },
                     Email: {
                         required: true,
                         email: true

                     },
                     PlaceBirth: {
                         required: true
                     },
                     job: {
                         required: true
                     }




                 }, //ket thuc rules
                 messages: {
                     username: {
                         required: "Username not null!!!"
                     },
                   
                    
                     name: {
                         required: "Name can not be null!!!!!!"
                     },
                     identificard: {
                         required: "Identificard can not be null!!!!",
                         number: "Identificard Must be number",
                         maxlength: "Max Length Is 20 Digit",
                         minlength: "Not Less Than 9 Digit"

                     },
                     birth: {
                         required: "Birth can not be null!!!!"
                     },
                     address: {
                         required: "Address not null!!!!!"

                     },
                     Email: {
                         required: "Email can not be null !!!!!",
                         email: "Email Must be under email form xxx@xxx.xxx"

                     },
                     PlaceBirth: {
                         required: "Place Birth can not be null"
                     },
                     job: {
                         required: "Job can not be null !!!!!"
                     }




                 }
             });  // ket thuc validate

             // $('#oldpassword').keyup(function() {
             //         $('#messge_error').html("");
             //    });


         });
         $(document).ready(function() {
         var now = $("#now").attr("value");
         var past = $("#past").attr("value");
             $('#birth').datepicker({
                 showButtonPanel: true,
                 changeMonth: true,
                 changeYear: true,
                 dateFormat: 'yy-mm-dd',
                 yearRange: 1950 + ':' + now

             });
         });             // ket thuc ready
    </script>

     
     <script type="text/javascript">

         var a = 0;
         var b = 0;
         var c = 0;
         var d = 0;
        
         $(document).ready(function () {

             $("#username").keyup(function() {
                 var status = $("#divcheck");
                 status.html("");
                 $("#a").attr("value", 0);
             });
             $("#username").blur(function() {

                 var name = $("#username").val();

                 var status = $("#divcheck");

                 status.html("Checking....").removeClass(); ;

                 $.post("/Admin/ManageUserAdmin/CheckNameUpdate", { username: name },

                    function(data) {

                        if (data == true) {

                            
                            status.html("Username is Valid!!!!").addClass("green");
                            $("#a").attr("value", 1);

                        } else {

                        status.html("Username is Not Valid!!!!").addClass("red");
                            $("#a").attr("value", 0);
                        }

                    });

             });

         });
    </script>
    <script type="text/javascript">

        $(document).ready(function() {



        $("#birth").click(function() {
                var status = $("#divcheckbirth");
                status.html("");
                $('#d').attr("value", 0);
            });
            $("#CheckBirth").click(function() {

                var name = $("#birth").val();

                var status = $("#divcheckbirth");

                status.html("Checking....").removeClass(); ;

                $.post("/ManageUserAdmin/CheckBirthday", { birth: name },

                    function(data) {

                        if (data == true) {

                            status.html("Birthday is Valid!!!!!!!").addClass("green");
                            $('#d').attr("value", 1);

                        } else {

                        status.html("You Must Be Above 18 Year Old").addClass("red");
                            $('#d').attr("value", 0);

                        }

                    });

            });

        });
    </script>
    
     <script type="text/javascript">

         $(document).ready(function() {

             $("#Email").keyup(function() {
                 var status = $("#divcheckEm");
                 status.html("");
                 $("#b").attr("value", 0);
             });
             $("#Email").blur(function() {

                 var name = $("#Email").val();

                 var status = $("#divcheckEm");

                 status.html("Checking....").removeClass(); ;

                 $.post("/Admin/ManageUserAdmin/CheckEmailUpdate", { Email: name },

                    function(data) {

                        if (data == true) {

                            status.html("Email is Valid!!!!!").addClass("green");

                            $("#b").attr("value", 1);
                        } else {

                            status.html("Email is not valid!!!!!").addClass("red");
                            $("#b").attr("value", 0);
                        }

                    });

             });

         });
    </script>
    
    
    
    
    <script type="text/javascript">

        $(document).ready(function() {

            $("#identificard").keyup(function() {
                var status = $("#divcheckIden");
                status.html("");
                $("#c").attr("value", 0);
            });
            $("#identificard").blur(function() {

                var name = $("#identificard").val();

                var status = $("#divcheckIden");

                status.html("Checking....").removeClass(); ;

                $.post("/Admin/ManageUserAdmin/CheckIdentifyUpdate", { identificard: name },

                    function(data) {

                        if (data == true) {

                            status.html("Identificard is Valid!!!").addClass("green");
                            $("#c").attr("value", 1);

                        } else {

                            status.html("Identificard is not Valid!!!").addClass("red");
                            $("#c").attr("value", 0);
                        }

                    });

            });


            $('#f1').submit(function() {
                a = $('#a').attr("value");
                b = $('#b').attr("value");
                c = $('#c').attr("value");
                d = $('#d').attr("value");
                if (a == 0) {
                    alert("Please Check Username,Or Username Not Valid");
                    return false;
                }
                else if (c == 0) {
                    alert("Please Check IdentifyCard,Or Identify Card Not Valid");
                    return false;
                }
                else if (b == 0) {
                    alert("Please Check Email,Or Email Not Valid");
                    return false;
                }
                else if (d == 0) {
                    alert("Please Check Birthday,Or Birthday Not Valid");
                }
                else if (a == 1 && b == 1 && c == 1 && d==1)
                    return true;
                return false;
            });
        });
    </script>
    <style type="text/css">
       .ui-autocomplete
       {
       
       	margin-left:760px;
       	margin-top:208px
              
       }
        .green

        {
            float:left;
            color: Green;
            margin-left:218px;
            margin-top:-9px;
        }

        .red

        {   float:left;
            margin-left:218px;
            color: Red;
            margin-top:-9px;
        }
        #divcheck
        {
        float:left;
        margin-left:14px;
        margin-top:-9px;	
        }
        .btnCheck
        {
        margin-left:11px;	
        	
        }
    </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

   <div class="center_block_top"><span>&nbsp;</span><h3>Change Information</h3></div>
<div class="center_block_mau"><!--section-->
	<div id="intro">
<blockquote>
<% if (ViewData["Result"] == "true")
      {
                  %>
         <div class="succes">
					<div class="succes_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Success!</span>
						<p>Your Action Is Success</p>
					</div>
				</div>
				<div class="clear"><!-- --></div>   
				<%} %>
				<%else if (ViewData["Result"] != null)
    { %>
				<div class="err">
					<div class="err_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Error!</span>
						<p><%=ViewData["Result"]%></p>
					</div>
				</div>
				<%} %>
  <div class="redistry">
  		<%  Username ac = (Username)ViewData["User"];
        Username ad = (Username)Session["Login"];

        using (Html.BeginForm("ResolveInformation", "Cashier", FormMethod.Post, new { @id = "f1" }))
        { %>
  		<ul>
        	<li>
            	<span>User Name:</span>
            	<div class="input_text"></div>
            	<div><input name="username" id="username" type="text" size="20" value="<%=ac.Username1 %>"/>
       
                    <input id="Hidden1" name="idadmin" value="<%=ad.IdUsername %>" type="hidden" />
                    <input id="Hidden2" type="hidden" name="iduser" value="<%=ac.IdUsername %>" />
                    
                    <input id="a" type="hidden" value="1" />
                    <input id="b" type="hidden" value="1"/>
                     <input id="c" type="hidden" value="1"/>
            	</div>
            	<div></div>
            	
                <div id="divcheck" class="error" visible="true"></div>
            	
            </li>
            
            <li>
            	<span>Name:</span>
            	<div class="input_text"></div>
            	<div><input name="name" id="name" type="text" size="20" value='<%=ac.Name %>' /></div>
            	
            	</li>
              <li>
            	<span>Secondary Pass:</span>
            	<div class="input_text"></div>
            	<div><input name="SecPass" type="password" size="20" /></div>
            	
            	
             </li>
            <li>
            	<span>Identity Card:</span>
            	<div class="input_text"></div>
            	<div><input name="identificard" id="identificard" type="text" size="20"  value='<%=ac.IdentityCard %>' /></div>
            	
                <div id="divcheckIden" class="error" visible="true"></div>
            	</li>
        		
            <li >
            	<span>Sex:</span>
            	
            	<%if (ac.Sex.Equals("Male"))
               { %>
                                <input id="Radio1" type="radio" name="sex" value="Male" checked="checked" />Male&nbsp;&nbsp;
                                <input id="Radio2" type="radio" name="sex" value="Female"/>Female
                                <%} %>
                            <%else
    { %>
                                <input id="Radio3" type="radio" name="sex" value="Male"  />Male&nbsp;&nbsp;
                                <input id="Radio4" type="radio" name="sex" value="Female" checked="checked"/>Female
                                <%} %>
            </li>
            <li>
            	<span>BirthDay:</span>
            	<div class="input_text"></div>
            	<div><input name="birth" type="text" id="birth" size="20" value='<%=ac.DateBirth.Value.ToString("yyyy-MM-dd") %>' /></div>
            	<div class="check1">
            	<a id="CheckBirth" href="#"> Check</a>
            	</div>
            	<input type="hidden" id="d" value="1" />
            	 <div id="divcheckbirth" class="error" visible="true"></div>
        		</li>
            <li>
            	<span>Address:</span>
            	<div class="input_text"></div>
            	<div><input name="address" id="address" type="text" size="20" value='<%=ac.Address %>' /></div>
        		</li>
            <li>
            	<span>Email:</span>
            	<div class="input_text"></div>
            	<div><input name="Email" id="Email" type="text" size="20"  value='<%=ac.Email %>'/></div>
            	
                <div id="divcheckEm" class="error" visible="true"></div>
        		</li>
            <li>
            	<span>PlaceBirth:</span>
            	<div class="input_text"></div>
            	<div><input name="PlaceBirth" id="PlaceBirth" type="text" size="20" value='<%=ac.PlaceBirth %>' /></div>
        		</li>
            <li>
            	<span>Job:</span>
            	<div class="input_text"></div>
            	<div><input name="job" id="job" type="text" size="20" value='<%=ac.Job %>'  /></div>
        		</li>
            <li>
            	<span>&nbsp;</span>
                <ul>
                	<li ><input type="submit" name="button" value="OK" class="ok"/></li>
                    <li id="cancel" ><input type="reset" name="button" value="Reset" class="ok" /></li>
                </ul>
            </li>
        </ul>
        <%} %>
  </div>
   
</blockquote>
<div class="clearBoth"></div>
<blockquote>
 
</blockquote>
</div>
<!--//intro-->
</div>
<div class="center_block_bottom_mau"></div>
<%DateTime past = DateTime.Now.AddYears(-18);
  DateTime now = DateTime.Now;
  string now1 = now.ToString("yyyy");
  string past1 = past.ToString("yyyy"); %>
    <input id="now" value="<%=now1%>" type="hidden" />
    <input id="past" value="<%=past1%>" type="hidden" />
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderScript" runat="server">


</asp:Content>
